<div class="box-header with-border">
    <h3 class="box-title">微信设置</h3>
    <!-- /.box-tools -->
</div>
<!-- /.box-header -->
<form role="form" onsubmit="return sub_setting_4()">
    <div class="box-body">
        <div class="form-group">
            <label for="wx_appid">微信AppID</label>
            <input type="text" class="form-control" value="{$sys['wx_appid']}" id="wx_appid" placeholder="微信AppID">
        </div>
        <div class="form-group">
            <label for="wx_secret">微信Secret</label>
            <input type="text" class="form-control" value="{$sys['wx_secret']}" id="wx_secret" placeholder="微信Secret">
        </div>
    </div>
    <!-- /.box-body -->

    <div class="box-footer">
        <button type="submit" class="btn btn-primary">保存</button>
    </div>
</form>

<script>
    function sub_setting_4(){

        var wx_appid = $("#wx_appid").val();
        if (wx_appid ==  "") {
            $.scojs_message("微信AppID不能为空", $.scojs_message.TYPE_ERROR);
            return false;
        }
        var wx_secret = $("#wx_secret").val();
        if (wx_secret ==  "") {
            $.scojs_message("微信Secret不能为空", $.scojs_message.TYPE_ERROR);
            return false;
        }
        $.ajax({
            type:"POST",
            url : '__ADMIN__/'+moduleName+'/setting',
            dataType:"json",
            data:{
                id:1,
                wx_appid:wx_appid,
                wx_secret:wx_secret
            },
            beforeSend:showLoad,
            success:function(msg) {
                if (msg.code == 0)
                    $.scojs_message(msg.msg, $.scojs_message.TYPE_OK);
                else
                    $.scojs_message(msg.msg, $.scojs_message.TYPE_ERROR);
                hideLoad();
            }
        });

        return false;
    }
</script>